import api from '../../api'

// 提交订单
const submitOrder = function (params) {
  return api.postRequest(api.requestURL + 'dlv/order/submit', params)
}

// 查询订单
const queryOrder = function (params) {
  return api.getRequest(api.requestURL + 'dlv/order/queryOrderByKey', params)
}

// 查询订单详情
const queryOrderDetail = function (params) {
  return api.getRequest(api.requestURL + 'dlv/order/queryOrderDetail', params)
}

// 管理员查询订单
const managerQueryOrder = function (params) {
  return api.postRequest(api.requestURL + 'travel/order/orderList', params, false, {'Content-Type': 'application/json'})
}

// 管理员查询订单详情 /dlv/order/queryOrderDetailOfAdmin
const queryOrderDetailOfAdmin = function (params) {
  return api.getRequest(api.requestURL + 'dlv/order/queryOrderDetailOfAdmin', params)
}

// 取消订单
const cancelOrder = function (params) {
  return api.getRequest(api.requestURL + 'dlv/order/cancel', params)
}

// 退款
const refund = function (params) {
  return api.getRequest(api.requestURL + 'dlv/order/refund', params)
}

// 删除订单
const delOrder = function (params) {
  return api.postRequest(api.requestURL + 'travel/order/deleteOrder', params,false, {'Content-Type': 'application/json'})
}

// 修改订单
const updateOrder = function (params) {
  return api.postRequest(api.requestURL + 'dlv/order/updateOrder', params)
}

// 批量提交临时订单
const batchSubmit = function (params) {
  return api.postRequest(api.requestURL + 'dlv/template/batchSubmit', params)
}

// 审批通过
const approve = function (params) {
  return api.postRequest(api.requestURL + 'travel/audit/approve', params, false, {'Content-Type': 'application/json'})
}

// 驳回
const reject = function (params) {
  return api.postRequest(api.requestURL + 'travel/audit/reject', params, false, {'Content-Type': 'application/json'})
}

// 审批列表
const auditList = function (params) {
  return api.postRequest(api.requestURL + 'travel/audit/auditList', params, false, {'Content-Type': 'application/json'})
}

export default {
  submitOrder,
  queryOrder,
  cancelOrder,
  managerQueryOrder,
  refund,
  delOrder,
  updateOrder,
  approve,
  queryOrderDetail,
  queryOrderDetailOfAdmin,
  batchSubmit,
  reject,
  auditList
}
